"""
URL configuration for djangoProject project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from typing import List, Any

from django.contrib import admin
from django.urls import path, URLResolver, URLPattern

from myapp import views

# 导入 `MyView` 类，用于处理视图逻辑
try:
    from my_project.views import MyView
except ImportError as e:
    print(f"Failed to import MyView: {e}")
    # 可以选择退出程序或采取其他措施
    # sys.exit(1)

urlpatterns: list[URLResolver | URLPattern | Any] = [
    path('admin/', admin.site.urls),
    path('', views.index, name='index'),  # 映射到 index.html
    path('about/', views.about, name='about'),  # 映射到 about.html
    path('shop/', views.shop, name='shop'),  # 映射到 shop.html
    path('contact/', views.contact, name='contact'),  # 映射到 contact.html
    path('login/', views.login_view, name='login'),
    path('logout/', views.logout_view, name='logout'),
    path('shop-single/', views.shop_single, name='shop-single'),
    path('cart/', views.cart, name='cart'),
    path('checkout/', views.checkout, name='checkout'),
    path('thankyou/', views.thankyou, name='thankyou'),
]
